<?php
namespace Home\Model;
use \Frame\Libs\BaseModel;

final class IndexModel extends BaseModel{
	//获取所有已结束的活动条数
	public function getActivityRows(){
		$sql = "SELECT activity_id FROM love_activity WHERE activity_status='2'";
		return $this->pdo->rowCount($sql);
	}
	
	//分页获取活动记录详情
	public function getActivity($startrows,$pagesize){
		$sql = "SELECT * FROM (SELECT * FROM love_activity WHERE activity_status='2') AS res ORDER BY activity_id DESC LIMIT $startrows,$pagesize";
		return $this->pdo->fetchAll($sql);
	}
	
	//按活动获取图片结果集
	public function getActivityPic($id){
		$sql = "SELECT * FROM love_activity_image WHERE activity_id='$id'";
		return $this->pdo->fetchAll($sql);
	}
}
?>